package com.vegetable.modules.entity.finance.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
@ApiModel(value = "字段映射DTO", description = "字段映射DTO")
public class FieldMappingDTO {
    
    @ApiModelProperty("文件列索引")
    private Integer columnIndex;
    
    @ApiModelProperty("文件列名称")
    private String columnName;
    
    @ApiModelProperty("映射到的系统字段名称")
    private String systemFieldName;
    
    @ApiModelProperty("系统字段显示名称")
    private String systemFieldDisplayName;
    
    @ApiModelProperty("字段类型：普通字段(normal)、收入金额字段(incomeAmount)、支出金额字段(expenseAmount)、类型标识字段(typeIdentifier)、付款人信息字段(payerInfo)、收款人信息字段(payeeInfo)")
    private String fieldType = "normal";
    
    /**
     * 验证字段类型是否有效
     * @return 是否有效
     */
    public boolean isValidFieldType() {
        if (fieldType == null) {
            return false;
        }
        
        switch (fieldType) {
            case "normal":
            case "incomeAmount":
            case "expenseAmount":
            case "typeIdentifier":
            case "payerInfo":
            case "payeeInfo":
                return true;
            default:
                return false;
        }
    }
}